<?php
/**
 * Created by PhpStorm.
 * User: cheng
 * Date: 2017/2/21
 * Time: 17:18
 */
    class ThrowJson{
        public function response($code, $message = '', $data = array()) {
            if(!(is_numeric($code))) {
                return '';
            }
            $result = array(
                'code' => $code,
                'message' => $message,
                'data' => $data
            );
            echo json_encode($result);
        }
    }